<include file="Public:head"/>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="ibox float-e-margins">
        <div class="ibox-title">
            <h5>协议设置</h5>
        </div>
        <div class="ibox-content">
            <form action="" method="post" enctype="multipart/form-data" id="brandForm" class="form-horizontal">
                <input type="hidden" name="id" value="{$da.id?$da.id:'';}">
                <div class="form-group">
                    <label class="col-sm-2 control-label">标题</label>

                    <div class="col-sm-6">
                        <input type="text" class="form-control" value="{$da.title?$da.title:'';}" name="title"  placeholder="标题">
                    </div>
                </div>
                <div class="hr-line-dashed"></div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">内容</label>
                    <div class="col-sm-10">
                        <script type="text/plain" id="editor" name="content" style="width:80%;height:250px;">
                            {$da.content?$da.content:'';}
                        </script>
                    </div>
                </div>
                <div class="hr-line-dashed"></div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">是否生效</label>
                    <div class="col-sm-6">
                        <label class="checkbox-inline">
                            <input type="radio" name="status"  value="1" <if condition="$da.status=='1'"> checked="checked"</if>>是
                        </label>
                        <label class="checkbox-inline">
                            <input type="radio" name="status"  value="0" <if condition="$da.status=='0'"> checked="checked"</if>>否
                        </label>
                    </div>
                </div>
                <div class="hr-line-dashed"></div>
                <div class="form-group">
                    <div class="col-sm-4 col-sm-offset-2">
                        <a href="JavaScript:void(0);" onclick="Submit();" class="btn btn-primary" id="submit">提交</a>
                        <!--<button class="btn btn-white" type="submit">取消</button>-->
                        <!--<input type="button" class="btn btn-primary" value="提交"/>-->
                    </div>
                </div>
            </form>
        </div>
    </div>
    <!-- End Panel Basic -->
</div>
<script type="text/javascript" src="__STATIC__/laydate/laydate.js"></script>
<script>
    function Submit(){
        var id = $('input[name="id"]').val();
        var title = $('input[name="title"]').val();
        var content = ue.getContent();
        var status = $('input[name="status"]:checked').val();

        $.post("{:url('Set/agreement')}",{
            id:id, title:title,content:content,status:status
        },function(result){
            if(result.code == '0'){
                parent.layer.msg(result.msg,{
                    shade:false,
                    icon:2,
                });
            }else{
                parent.layer.msg(result.msg,{
                            icon:1,
                            time:1000,
                        },
                        function (index, item) {
                            location.href = result.url;
                        });
            }
        });

    };
</script>

<script type="text/javascript">

    //实例化编辑器
    //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
    var ue = UE.getEditor('editor');

</script>

</body>

</html>